package com.redball.ams.web.comtroller;

import com.redball.ams.common.model.PageObject;
import com.redball.ams.common.model.JsonResult;
import com.redball.ams.model.SysLog;
import com.redball.ams.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/log/")
public class SysLogController {

        @Autowired
        private SysLogService sysLogService;
        @RequestMapping("doFindPageObjects")
        @ResponseBody
        public JsonResult doFindPageObjects(String username, Integer pageCurrent){
                PageObject<SysLog> pageObject= sysLogService.findPageObjects(username,pageCurrent);
                return new JsonResult(pageObject);

        }
/*
        @RequestMapping("doDeleteObjects")
        @ResponseBody
        public JsonResult doDeleteObjects(Integer... ids){
                sysLogService.deleteObjects(ids);
                return new JsonResult("delete ok");

        }*/

        //@RequestMapping(value="/log/doDeleteObjects/{ids}",method = RequestMethod.DELETE)
        @DeleteMapping("/log/doDeleteObjects/{ids}")//rest
        public JsonResult doDeleteObjects(@PathVariable Integer... ids){
                sysLogService.deleteObjects(ids);
                return new JsonResult("delete ok");
        }

}